package com.jianying.shared;

public class TableSpec {

	private Integer pageSize;
	
	private Integer currentPage;
	
	private String sortBy;
	
	private String sortIndicator;

	/**
	 * 排序的 字段名称规则为表名_字段名
	 * 表名和字段名驼峰式命名
	 * 这里需要改成下划线跟数据库匹配
	 * @return
	 */
	public String getOrderBy(){
		if(sortBy == null || sortBy.trim() == ""){
			return null;
		}
		String[] bys = sortBy.split("_");
		String by = Utils.underscore(bys[0].trim()) + "_" + Utils.underscore(bys[1].trim());
		return by + "." + sortIndicator.trim();
	}
	
	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}

	public String getSortBy() {
		return sortBy;
	}

	public void setSortBy(String sortBy) {
		this.sortBy = sortBy;
	}

	public String getSortIndicator() {
		return sortIndicator;
	}

	public void setSortIndicator(String sortIndicator) {
		this.sortIndicator = sortIndicator;
	}
	
}
